package org.je.util;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @author fanyifeng
 */
public class CollectionUtil
{
	/**
	 * @param list
	 * @return copied array list
	 */
	public static <T> List<T> copyList(List<T> list) {
		if (list == null)
			return null;
		List<T> rst = new ArrayList<T>();
		for (T t : list) {
			rst.add(t);
		}
		return rst;
	}

	/**
	 * @param col
	 * @param spr
	 * @return joined str
	 */
	public static String join(Collection<String> col, String spr) {
		StringBuilder bf = new StringBuilder();
		for (String s : col) {
			bf.append(spr);
			bf.append(s);
		}
		return bf.toString();
	}
}
